.class public final Lnbisdk/bc;
.super Ljava/lang/Object;

# interfaces
.implements Landroid/location/LocationListener;
.implements Lnbisdk/cj;


# static fields
.field private static cj:Lnbisdk/bc;


# instance fields
.field private ca:Lcom/nbi/common/NBIContext;

.field ck:Landroid/location/LocationManager;

.field cl:Landroid/location/GpsStatus;

.field private cm:I

.field private cn:Z

.field private co:J

.field private cp:Lcom/nbi/location/Location;

.field private cq:Z

.field private cr:I

.field private cs:Landroid/location/GpsStatus$Listener;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    const/4 v0, 0x0

    sput-object v0, Lnbisdk/bc;->cj:Lnbisdk/bc;

    return-void
.end method

.method private constructor <init>(Lcom/nbi/common/NBIContext;)V
    .locals 4

    const/4 v3, 0x0

    const/4 v2, 0x0

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    iput-object v3, p0, Lnbisdk/bc;->ca:Lcom/nbi/common/NBIContext;

    iput-object v3, p0, Lnbisdk/bc;->ck:Landroid/location/LocationManager;

    iput-object v3, p0, Lnbisdk/bc;->cl:Landroid/location/GpsStatus;

    iput v2, p0, Lnbisdk/bc;->cm:I

    iput-boolean v2, p0, Lnbisdk/bc;->cn:Z

    const-wide/16 v0, 0x0

    iput-wide v0, p0, Lnbisdk/bc;->co:J

    iput-object v3, p0, Lnbisdk/bc;->cp:Lcom/nbi/location/Location;

    iput-boolean v2, p0, Lnbisdk/bc;->cq:Z

    iput v2, p0, Lnbisdk/bc;->cr:I

    new-instance v0, Lnbisdk/lx;

    invoke-direct {v0, p0}, Lnbisdk/lx;-><init>(Lnbisdk/bc;)V

    iput-object v0, p0, Lnbisdk/bc;->cs:Landroid/location/GpsStatus$Listener;

    if-nez p1, :cond_0

    :goto_0
    return-void

    :cond_0
    iput-object p1, p0, Lnbisdk/bc;->ca:Lcom/nbi/common/NBIContext;

    invoke-direct {p0}, Lnbisdk/bc;->bk()V

    goto :goto_0
.end method

.method static synthetic a(Lnbisdk/bc;)I
    .locals 2

    iget v0, p0, Lnbisdk/bc;->cr:I

    add-int/lit8 v1, v0, 0x1

    iput v1, p0, Lnbisdk/bc;->cr:I

    return v0
.end method

.method static synthetic a(Lnbisdk/bc;I)I
    .locals 1

    const/4 v0, 0x0

    iput v0, p0, Lnbisdk/bc;->cr:I

    return v0
.end method

.method public static a(Lcom/nbi/common/NBIContext;)Lnbisdk/bc;
    .locals 1

    sget-object v0, Lnbisdk/bc;->cj:Lnbisdk/bc;

    if-nez v0, :cond_1

    new-instance v0, Lnbisdk/bc;

    invoke-direct {v0, p0}, Lnbisdk/bc;-><init>(Lcom/nbi/common/NBIContext;)V

    sput-object v0, Lnbisdk/bc;->cj:Lnbisdk/bc;

    :cond_0
    :goto_0
    sget-object v0, Lnbisdk/bc;->cj:Lnbisdk/bc;

    return-object v0

    :cond_1
    if-eqz p0, :cond_0

    sget-object v0, Lnbisdk/bc;->cj:Lnbisdk/bc;

    iput-object p0, v0, Lnbisdk/bc;->ca:Lcom/nbi/common/NBIContext;

    goto :goto_0
.end method

.method private bj()Z
    .locals 2

    const/4 v1, 0x0

    iget-object v0, p0, Lnbisdk/bc;->ck:Landroid/location/LocationManager;

    if-eqz v0, :cond_1

    iget-object v0, p0, Lnbisdk/bc;->ck:Landroid/location/LocationManager;

    invoke-virtual {v0, p0}, Landroid/location/LocationManager;->removeUpdates(Landroid/location/LocationListener;)V

    iput-boolean v1, p0, Lnbisdk/bc;->cq:Z

    sget-boolean v0, Lnbisdk/bk;->cG:Z

    if-eqz v0, :cond_0

    invoke-static {}, Lnbisdk/cq;->dZ()V

    :cond_0
    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_1
    move v0, v1

    goto :goto_0
.end method

.method private bk()V
    .locals 3

    const/4 v2, 0x0

    iget-object v0, p0, Lnbisdk/bc;->ca:Lcom/nbi/common/NBIContext;

    invoke-virtual {v0}, Lcom/nbi/common/NBIContext;->getInternalObject()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lnbisdk/bl;

    if-nez v0, :cond_0

    :goto_0
    return-void

    :cond_0
    invoke-virtual {v0}, Lnbisdk/bl;->jw()Landroid/content/Context;

    move-result-object v0

    const-string v1, "location"

    invoke-virtual {v0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/location/LocationManager;

    iput-object v0, p0, Lnbisdk/bc;->ck:Landroid/location/LocationManager;

    iget-object v0, p0, Lnbisdk/bc;->ck:Landroid/location/LocationManager;

    if-eqz v0, :cond_2

    iget-object v0, p0, Lnbisdk/bc;->ck:Landroid/location/LocationManager;

    const-string v1, "gps"

    invoke-virtual {v0, v1}, Landroid/location/LocationManager;->isProviderEnabled(Ljava/lang/String;)Z

    move-result v0

    if-nez v0, :cond_1

    iput-boolean v2, p0, Lnbisdk/bc;->cn:Z

    goto :goto_0

    :cond_1
    iget-object v0, p0, Lnbisdk/bc;->ck:Landroid/location/LocationManager;

    iget-object v1, p0, Lnbisdk/bc;->cs:Landroid/location/GpsStatus$Listener;

    invoke-virtual {v0, v1}, Landroid/location/LocationManager;->addGpsStatusListener(Landroid/location/GpsStatus$Listener;)Z

    goto :goto_0

    :cond_2
    iput-boolean v2, p0, Lnbisdk/bc;->cn:Z

    goto :goto_0
.end method

.method private bl()Z
    .locals 8

    const/4 v7, 0x1

    const/4 v6, 0x0

    iget-object v0, p0, Lnbisdk/bc;->ck:Landroid/location/LocationManager;

    if-nez v0, :cond_0

    move v0, v6

    :goto_0
    return v0

    :cond_0
    :try_start_0
    iget-boolean v0, p0, Lnbisdk/bc;->cq:Z

    if-nez v0, :cond_1

    iget-object v0, p0, Lnbisdk/bc;->ck:Landroid/location/LocationManager;

    const-string v1, "gps"

    const-wide/16 v2, 0x3e8

    const/4 v4, 0x0

    move-object v5, p0

    invoke-virtual/range {v0 .. v5}, Landroid/location/LocationManager;->requestLocationUpdates(Ljava/lang/String;JFLandroid/location/LocationListener;)V

    const/4 v0, 0x1

    iput-boolean v0, p0, Lnbisdk/bc;->cq:Z
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    :cond_1
    move v0, v7

    goto :goto_0

    :catch_0
    move-exception v0

    move v0, v6

    goto :goto_0
.end method


# virtual methods
.method public final a(Lcom/nbi/location/Location;)V
    .locals 2

    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v0

    iput-wide v0, p0, Lnbisdk/bc;->co:J

    iput-object p1, p0, Lnbisdk/bc;->cp:Lcom/nbi/location/Location;

    return-void
.end method

.method public final bf()J
    .locals 4

    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v0

    iget-wide v2, p0, Lnbisdk/bc;->co:J

    sub-long/2addr v0, v2

    return-wide v0
.end method

.method public final bg()Lcom/nbi/location/Location;
    .locals 1

    iget-object v0, p0, Lnbisdk/bc;->cp:Lcom/nbi/location/Location;

    return-object v0
.end method

.method public final bh()I
    .locals 1

    iget v0, p0, Lnbisdk/bc;->cm:I

    return v0
.end method

.method public final bi()Z
    .locals 2

    iget-object v0, p0, Lnbisdk/bc;->cl:Landroid/location/GpsStatus;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lnbisdk/bc;->cl:Landroid/location/GpsStatus;

    invoke-virtual {v0}, Landroid/location/GpsStatus;->getTimeToFirstFix()I

    move-result v0

    const/16 v1, 0x7d0

    if-ge v0, v1, :cond_0

    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public final bm()V
    .locals 0

    invoke-direct {p0}, Lnbisdk/bc;->bl()Z

    return-void
.end method

.method public final destroy()V
    .locals 2

    invoke-direct {p0}, Lnbisdk/bc;->bj()Z

    iget-object v0, p0, Lnbisdk/bc;->ck:Landroid/location/LocationManager;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lnbisdk/bc;->ck:Landroid/location/LocationManager;

    iget-object v1, p0, Lnbisdk/bc;->cs:Landroid/location/GpsStatus$Listener;

    invoke-virtual {v0, v1}, Landroid/location/LocationManager;->removeGpsStatusListener(Landroid/location/GpsStatus$Listener;)V

    :cond_0
    const/4 v0, 0x0

    iput-object v0, p0, Lnbisdk/bc;->ck:Landroid/location/LocationManager;

    return-void
.end method

.method public final getMaxSatellites()I
    .locals 1

    iget v0, p0, Lnbisdk/bc;->cr:I

    return v0
.end method

.method public final isEnabled()Z
    .locals 3

    const/4 v2, 0x0

    iget-object v0, p0, Lnbisdk/bc;->ca:Lcom/nbi/common/NBIContext;

    invoke-virtual {v0}, Lcom/nbi/common/NBIContext;->getInternalObject()Ljava/lang/Object;

    move-result-object p0

    check-cast p0, Lnbisdk/bl;

    if-nez p0, :cond_0

    move v0, v2

    :goto_0
    return v0

    :cond_0
    invoke-virtual {p0}, Lnbisdk/bl;->jw()Landroid/content/Context;

    move-result-object v0

    const-string v1, "location"

    invoke-virtual {v0, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object p0

    check-cast p0, Landroid/location/LocationManager;

    if-eqz p0, :cond_1

    const-string v0, "gps"

    invoke-virtual {p0, v0}, Landroid/location/LocationManager;->isProviderEnabled(Ljava/lang/String;)Z

    move-result v0

    goto :goto_0

    :cond_1
    move v0, v2

    goto :goto_0
.end method

.method public final onLocationChanged(Landroid/location/Location;)V
    .locals 0

    invoke-direct {p0}, Lnbisdk/bc;->bj()Z

    return-void
.end method

.method public final onProviderDisabled(Ljava/lang/String;)V
    .locals 1

    const-string v0, "gps"

    if-ne p1, v0, :cond_0

    invoke-direct {p0}, Lnbisdk/bc;->bj()Z

    const/4 v0, 0x0

    iput-boolean v0, p0, Lnbisdk/bc;->cn:Z

    :cond_0
    return-void
.end method

.method public final onProviderEnabled(Ljava/lang/String;)V
    .locals 1

    const-string v0, "gps"

    if-ne p1, v0, :cond_0

    invoke-direct {p0}, Lnbisdk/bc;->bk()V

    :cond_0
    return-void
.end method

.method public final onStatusChanged(Ljava/lang/String;ILandroid/os/Bundle;)V
    .locals 2

    const/4 v1, 0x0

    const-string v0, "gps"

    if-ne p1, v0, :cond_0

    packed-switch p2, :pswitch_data_0

    :cond_0
    :goto_0
    return-void

    :pswitch_0
    const/16 v0, 0x9

    iput v0, p0, Lnbisdk/bc;->cm:I

    iput v1, p0, Lnbisdk/bc;->cr:I

    invoke-direct {p0}, Lnbisdk/bc;->bj()Z

    goto :goto_0

    :pswitch_1
    const/16 v0, 0x8

    iput v0, p0, Lnbisdk/bc;->cm:I

    iput v1, p0, Lnbisdk/bc;->cr:I

    invoke-direct {p0}, Lnbisdk/bc;->bj()Z

    goto :goto_0

    nop

    :pswitch_data_0
    .packed-switch 0x0
        :pswitch_0
        :pswitch_1
    .end packed-switch
.end method
